<template>
	<view v-if="!isFirstload" class="container">
		<!-- 页面头部 -->
		<view class="main-header"
			:style="{ height: platform == 'H5' ? '260rpx' : '320rpx', paddingTop: platform == 'H5' ? '0' : '80rpx' }">
			<image class="bg-image" src="/static/background/user-header2.png" mode="scaleToFill"></image>
			<!-- 用户信息 -->
			<view v-if="isLogin" class="user-info">
				<view class="user-info-box">
					<view style="margin-top: 15rpx;" class="user-avatar" @click="handlePersonal()">
						<avatar-image :url="userInfo.avatar_url" :width="120" />
					</view>
					<view class="user-content">
						<!-- 会员昵称 -->
						<view class="nick-name oneline-hide" @click="handlePersonal()">{{ userInfo.nick_name }}</view>
						<!-- 会员无等级时显示手机号 -->
						<view class="mobile">{{ userInfo.mobile }}</view>
						<view class="" v-if="!isShowMyApp">
							我的收入：{{ allBalanceValue || '--' }}
						</view>
						<view style="height: 25px;" class="" v-else>
						</view>
					</view>

					<!-- 会员等级 -->
					<view class="user-grade" @click="rankRule">
						<view class="user-grade_icon">
							<view v-if="userInfo.level === 0" class="ordinary-user" @click="isIos ? '' : rankRule()">
								普通用户
							</view>
							<image v-else style="height: 16px;background-color: #fff;border-radius: 20px; margin-left: 8px;"
								:src="levelList[userInfo.level]" mode="heightFix" @click="rankRule" />
						</view>
					</view>
				</view>
				<view class="user-invite" @click="inviteFriend">
					邀请好友
				</view>
			</view>
			<!-- 未登录 -->
			<view v-else class="user-info-unlogin" @click="handleLogin">
				<view class="user-avatar">
					<avatar-image :width="100" />
				</view>
				<view class="user-content">
					<view class="nick-name">未登录</view>
					<view class="login-tips">点击登录账号</view>
				</view>
			</view>
		</view>

		<!-- 我的钱包 -->
		<view v-if="!isShowMyApp" class="my-asset">
			<view class="asset-left flex-box dis-flex flex-x-around">
				<view class="asset-left-item" style="max-width: 200rpx;" @click="onTargetWallet">
					<view class="item-value dis-flex flex-x-center">
						<text>{{ isLogin ? balanceValue : '--' }}</text>
					</view>
					<view class="item-name dis-flex flex-x-center">
						<text class="oneline-hide">账户余额</text>
					</view>
				</view>
				<view class="asset-left-item" style="max-width: 200rpx;" @click="onLXBean">
					<view class="item-value dis-flex flex-x-center">
						<text>{{ isLogin ? lxBeanValue : '--' }}</text>
					</view>
					<view class="item-name dis-flex flex-x-center">
						<text class="oneline-hide">乐享豆</text>
					</view>
				</view>
				<view class="asset-left-item" @click="onTargetPoints">
					<view class="item-value dis-flex flex-x-center">
						<text>{{ isLogin ? Math.floor(assets.points) : '--' }}</text>
					</view>
					<view class="item-name dis-flex flex-x-center">
						<text class="oneline-hide">购物积分</text>
					</view>
				</view>
				<!-- 				<view class="asset-left-item" @click="onTargetMyCoupon">
					<view class="item-value dis-flex flex-x-center">
						<text class="oneline-hide">{{ isLogin ? userInfo.contribution_value : '--' }}</text>
					</view>
					<view class="item-name dis-flex flex-x-center">
						<text>贡献值</text>
					</view>
				</view> -->
				<view class="asset-left-item asset-right">
					<view class="asset-right-item" @click="onMyTeam">
						<view class="item-value dis-flex flex-x-center">
							<text class="oneline-hide">{{ isLogin ? userInfo.tan_count : '--' }}</text>
						</view>
						<view class="item-name dis-flex flex-x-center">
							<text>我的团队</text>
						</view>
					</view>
				</view>
			</view>
		</view>

		<!-- 每日签到 -->
		<view v-if="!isShowMyApp" class="signin-box">
			<view class="signin-title">
				<text>每日签到</text>
				<text style="font-size: 24rpx; font-weight: 300; margin-right: 30rpx;" @click="onTargetSign">签到记录</text>
			</view>
			<view class="signin-content">
				<view class="signin-child" v-for="(item, index) in signinLists.dates" :key="index"
					@click="receiveRedEnvelope(item.status, item.is_sign, item.money)">
					<view class="child-top">

						<view :class="item.status === 0 && item.is_sign === 0 ? transformClass : ''"
							v-if="(item.status === 0 || item.status === 1) && item.is_sign === 0" class="success-box">
							<image style="width: 36%;" src="@/static/close-red-envelope.png" mode="widthFix"></image>
							<text class="success-title" style="color: #fff;">{{ item.money }}</text>
						</view>
						<view v-else-if="item.is_sign === 1" class="success-box">
							<image class="success-img" style="width: 45%;" src="@/static/success-red-envelope.png" mode="widthFix">
							</image>
							<text class="success-title">{{ item.money }}</text>
							<text class="success-tip">已领取</text>
						</view>
						<view v-else class="success-box">
							<image style="width: 36%;" src="@/static/fail-red-envelope.png" mode="widthFix"></image>
							<text class="success-title" style="color: #fff;">已过期</text>
						</view>

					</view>
					<text>{{ setTime(item.date) }}</text>
				</view>
			</view>

			<view class="box-line"></view>
		</view>

		<!-- 订单操作 -->
		<view class="order-navbar">
			<view class="order-navbar-item" v-for="(item, index) in orderNavbar" :key="index" @click="onTargetOrder(item)">
				<view class="item-icon">
					<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
				</view>
				<view class="item-name">{{ item.name }}</view>
				<view class="item-badge" v-if="item.count && item.count > 0">
					<text v-if="item.count <= 99" class="text">{{ item.count }}</text>
					<text v-else class="text">99+</text>
				</view>
			</view>
		</view>

		<!-- 我的服务 -->
		<view class="my-service">
			<view class="service-title">我的服务</view>
			<view class="service-content clearfix">
				<block v-for="(item, index) in service" :key="index">
					<view v-if="item.type == 'link'" class="service-item" @click="handleService(item)">
						<view class="item-icon">
							<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
						</view>
						<view class="item-name">{{ item.name }}</view>
						<view class="item-badge" v-if="item.count && item.count > 0">
							<text v-if="item.count <= 99" class="text">{{ item.count }}</text>
							<text v-else class="text">99+</text>
						</view>
					</view>
					<view v-if="item.type == 'button' && platform == 'MP-WEIXIN'" class="service-item">
						<button class="btn-normal" :open-type="item.openType">
							<view class="item-icon">
								<text class="iconfont" :class="[`icon-${item.icon}`]"></text>
							</view>
							<view class="item-name">{{ item.name }}</view>
						</button>
					</view>
				</block>
			</view>
		</view>

		<!-- 退出登录 -->
		<view v-if="isLogin" class="my-logout">
			<view class="logout-btn" @click="handleLogout()">
				<text>退出登录</text>
			</view>
			<text style="color: #fe1919;" @click="cancelAccount">注销账号</text>
		</view>
		<u-popup v-model="isPassWord" mode="center" :closeable="true" border-radius="20">
			<view class="password_box">
				<view class="password_title">
					{{ userInfo.password ? '修改密码' : '设置密码' }}
				</view>
				<u-form class="form" label-width="190" :model="passWord" ref="uForm">
					<u-form-item label="登陆密码">
						<u-input v-model="passWord.text1" type="password" placeholder="请输入登录密码" />
					</u-form-item>
					<u-form-item label="设置密码">
						<u-input v-model="passWord.text2" type="password" placeholder="请输入新密码" />
					</u-form-item>
					<u-form-item label="确认密码">
						<u-input v-model="passWord.text3" type="password" placeholder="再次输入新密码确认" />
					</u-form-item>
				</u-form>
				<view class="button" @click="passWordSubmit">
					确定
				</view>
			</view>
		</u-popup>
		<uni-popup ref="popup" type="center">
			<view class="rule-box">
				<view class="rule-title">
					等级规则
				</view>
				<view class="rule-table">
					<table cellpadding='5'>
						<tr>
							<th>等级</th>
							<th>升级条件</th>
							<th>539元</th>
							<th>2695元</th>
							<th>5390元</th>
						</tr>
						<tr v-for="item in ruleLists" :key="item.grade">
							<td>{{ item.grade }}</td>
							<td>{{ item.condition }}</td>
							<td>{{ item.first }}</td>
							<td>{{ item.second }}</td>
							<td>{{ item.third }}</td>
						</tr>
					</table>
				</view>
				<view class="rule-attention">
					注：升级以后将获得团队奖励，等级有级差，直推平级奖励10%。
				</view>
				<view class="close-icon" @click="closePopup">
					<image mode="widthFix" style="width: 32rpx" src="@/static/clear.png" alt="" />
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="redEnvelopePopup" type="center" @maskClick="maskClick">
			<view class="red-envelope-box">
				<view class="img-box">
					<image class="box-img" src="@/static/red-envelope-bg.png" mode="widthFix"></image>
					<view class="box-title">
						<view class="title-top">
							恭喜您获得
						</view>
						<view class="title-bottom">
							<text style="font-size: 120rpx; font-weight: 1000; color: #fff;">{{ successMoney }}</text>
							<text style="font-size: 50rpx; color: #fff;">元</text>
						</view>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
import store from '@/store'
import AvatarImage from '@/components/avatar-image'
import {
	setCartTabBadge,
	showError,
	showSuccess,
	showToast
} from '@/core/app'
import SettingKeyEnum from '@/common/enum/setting/Key'
import Config from '@/core/config'
import SettingModel from '@/common/model/Setting'
import * as UserApi from '@/api/user'
import * as OrderApi from '@/api/order'
import * as SigninApi from '@/api/signin.js'
import {
	checkLogin
} from '@/core/app'

// 订单操作
const orderNavbar = [{
	id: 'all',
	name: '全部订单',
	icon: 'qpdingdan'
},
{
	id: 'payment',
	name: '待支付',
	icon: 'daifukuan',
	count: 0
},
{
	id: 'delivery',
	name: '待发货',
	icon: 'daifahuo',
	count: 0
},
{
	id: 'received',
	name: '待收货',
	icon: 'daishouhuo',
	count: 0
},
]

/**
 * 我的服务
 * id: 标识; name: 标题名称; icon: 图标; type 类型(link和button); url: 跳转的链接
 */
const service = [
	{
		id: 'help',
		name: '支付密码',
		icon: 'suo',
		type: 'link',
		url: 'dialog'
	}, {
		id: 'address',
		name: '收货地址',
		icon: 'shouhuodizhi',
		type: 'link',
		url: 'pages/address/index'
	},
	{
		id: 'refund',
		name: '退换/售后',
		icon: 'shouhou',
		type: 'link',
		url: 'pages/refund/index',
		count: 0
	},
	{
		id: 'help',
		name: '我的帮助',
		icon: 'bangzhu',
		type: 'link',
		url: 'pages/help/index'
	},
]

const ruleLists = [{
	grade: '员工',
	condition: '30单',
	first: '45元',
	second: `${45 * 5}元`,
	third: `${45 * 10}元`
},
{
	grade: '主管',
	condition: '99单',
	first: '25元',
	second: `${25 * 5}元`,
	third: `${25 * 10}元`
},
{
	grade: '经理',
	condition: '199单',
	first: '20元',
	second: `${20 * 5}元`,
	third: `${20 * 10}元`
},
{
	grade: '总经理',
	condition: '599单',
	first: '15元',
	second: `${15 * 5}元`,
	third: `${15 * 10}元`
},
{
	grade: '总监',
	condition: '1499单',
	first: '10元',
	second: `${10 * 5}元`,
	third: `${10 * 10}元`
},
{
	grade: '董事长',
	condition: '9999单',
	first: '5元',
	second: `${5 * 5}元`,
	third: `${5 * 10}元`
},
]

const isIos = Config.get('isIos')

export default {
	components: {
		AvatarImage
	},
	data() {
		return {
			// 设置密码
			passWord: {
				text1: '',
				text2: '',
				text3: '',
			},
			isPassWord: false,
			// 等级规则弹窗
			isRankRule: false,
			// 枚举类
			SettingKeyEnum,
			// 正在加载
			isLoading: true,
			// 首次加载
			isFirstload: true,
			// 是否已登录
			isLogin: false,
			// 系统设置
			setting: {},
			// 当前用户信息
			userInfo: {},
			// 账户资产
			assets: {
				balance: '--',
				points: '--',
				coupon: '--',
			},
			// 我的服务
			service,
			// 订单操作
			orderNavbar,
			ruleLists,
			// 当前用户待处理的订单数量
			todoCounts: {
				payment: 0,
				deliver: 0,
				received: 0
			},
			levelList: [
				'',
				// '普通员工',
				'/static/employee.jpg',
				// '员工',
				'/static/supervisor.jpg',
				// '主管',
				'/static/manager.jpg',
				// '经理',
				'/static/general-manager.jpg',
				// '总经理',
				'/static/director.jpg',
				// '总监',
				'/static/chairman-board.jpg'
				// '董事长'
			],
			transformClass: '',
			signinLists: [],
			successMoney: '',
			isIos: store.getters.isIos
		}
	},

	/**
	 * 生命周期函数--监听页面显示
	 */
	onShow(options) {
		console.log(isIos, 'isIos');
		this.onRefreshPage();
		this.getSigninList();
		this.transformClass = 'child-transform';
	},

	computed: {
		balanceValue() {
			const str = this.assets.balance;
			if (str.indexOf(".") !== -1) {
				return String(str).substr(0, String(str).indexOf(".") + 3)
			} else {
				return `${str}.00`
			}
		},
		allBalanceValue() {
			const str = this.userInfo.all_balance_yes;
			if (str.indexOf(".") !== -1) {
				return String(str).substr(0, String(str).indexOf(".") + 3)
			} else {
				return `${str}.00`
			}
		},
		lxBeanValue() {
			const str = this.userInfo.pay_points;
			if (str.indexOf(".") !== -1) {
				return String(str).substr(0, String(str).indexOf(".") + 3)
			} else {
				return `${str}.00`
			}
		},
		isShowMyApp() {
			const isShow = uni.getStorageSync('isShow');
			if (!isShow) return false;
			if (isShow === 'fasle') return false;
			if (isShow === 'true') return true;
		},
	},

	watch: {
		transformClass(nData, oData) {
			if (nData === 'child-transform') {
				const timer = setInterval(() => {
					this.transformClass = '';
					clearInterval(timer);
				}, 3000)
			} else {
				const timer = setInterval(() => {
					this.transformClass = 'child-transform';
					clearInterval(timer);
				}, 3000)
			}
		}
	},

	methods: {
		// 设置密码确定
		passWordSubmit() {
			if (this.passWord.text2 !== this.passWord.text3) {
				this.$toast('两次输入的密码不一致')
				this.passWord.text3 = ''
				return
			}
			UserApi.password({
				password: this.passWord.text1,
				pay_password: this.passWord.text2,
			}).then(res => {
				if (res.status === 200) {
					this.$success(res.message)
					this.isPassWord = false
				}
			})
		},
		// 印射时间
		setTime(date) {
			const dateValue = date.split('-');
			const time = new Date();
			const yearTime = String(new Date().getFullYear());
			let monthTime = String(new Date().getMonth() + 1);
			const dateTime = String(new Date().getDate());
			if (monthTime.length === 1) {
				monthTime = `0${monthTime}`;
			}
			if (dateValue[0] === yearTime) {
				if (dateValue[1] === monthTime) {
					if (dateValue[2] === dateTime) {
						return '今天'
					} else if (Number(dateValue[2]) - Number(dateTime) === 1) {
						return '明天'
					} else {
						return `${dateValue[1]}-${dateValue[2]}`
					}
				} else if (Number(dateValue[1]) - Number(monthTime) === 1 && Number(dateValue[2]) === 1) {
					return '明天'
				} else {
					return `${dateValue[1]}-${dateValue[2]}`
				}
			}
		},
		// 获取签到列表
		getSigninList() {
			SigninApi.signlist().then(res => {
				this.signinLists = res.data;
				console.log(res, 'res:------------');
			})
		},

		// 注销账号
		cancelAccount() {
			uni.showModal({
				title: '温馨提示',
				content: '确定注销账号吗?',
				success: ({
					confirm
				}) => {
					if (confirm) {
						UserApi.logOff().then(res => {
							store.dispatch('Logout', {})
								.then(result => this.onRefreshPage())
						})
					}
				}
			})
		},
		// 点击领取红包
		receiveRedEnvelope(status, isSign, money) {
			const app = this;
			console.log(status);
			switch (status) {
				case -1:
					if (isSign === 1) {
						uni.showToast({
							title: '该奖励已领取',
							icon: 'none'
						})
					} else {
						uni.showToast({
							title: '该奖励已过期',
							icon: 'none'
						})
					}
					break;
				case 0:
					if (this.signinLists.is_je === 0) {
						uni.showToast({
							title: '您已出局，暂无法领取奖励',
							icon: 'none'
						})
						return;
					}
					if (isSign === 1) {
						uni.showToast({
							title: '该奖励已领取',
							icon: 'none'
						})
					} else {
						app.successMoney = money;
						uni.showToast({
							icon: 'loading',
							title: '正在领取中',
							success() {
								SigninApi.signset().then(res => {
									app.$refs.redEnvelopePopup.open('center');
								})
							}
						})
					}
					break;
				case 1:
					uni.showToast({
						title: '未到领取时间',
						icon: 'none'
					})
					break;
				default:
					break;
			}
		},
		maskClick() {
			this.onRefreshPage();
			this.getSigninList();
		},
		// 打开邀请好友权限弹窗
		inviteFriend() {
			this.$navTo('components/page/inviteFriends/index');
		},
		closePopup() {
			this.$refs.popup.close();
		},

		rankRule() {
			this.$refs.popup.open('center');
		},
		// 刷新页面
		onRefreshPage() {
			// 更新购物车角标
			setCartTabBadge()
			// 判断是否已登录
			this.isLogin = checkLogin()
			// 获取页面数据
			this.getPageData()
		},

		// 获取页面数据
		getPageData(callback) {
			const app = this
			app.isLoading = true
			Promise.all([app.getSetting(), app.getUserInfo(), app.getUserAssets(), app.getTodoCounts()])
				.then(result => {
					app.isFirstload = false
					// 初始化我的服务数据
					app.initService()
					// 初始化订单操作数据
					app.initOrderTabbar()
					// 执行回调函数
					callback && callback()
				})
				.catch(err => console.log('catch', err))
				.finally(() => app.isLoading = false)
		},

		// 初始化我的服务数据
		initService() {
			const app = this
			const newService = []
			service.forEach(item => {
				if (item.id === 'points') {
					item.name = '我的' + app.setting[SettingKeyEnum.POINTS.value].points_name
				}
				// 数据角标
				if (item.count != undefined) {
					item.count = app.todoCounts[item.id]
				}
				newService.push(item)
			})
			app.service = newService
		},

		// 初始化订单操作数据
		initOrderTabbar() {
			const app = this
			const newOrderNavbar = []
			orderNavbar.forEach(item => {
				if (item.count != undefined) {
					item.count = app.todoCounts[item.id]
				}
				newOrderNavbar.push(item)
			})
			app.orderNavbar = newOrderNavbar
		},

		// 获取商城设置
		getSetting() {
			const app = this
			return new Promise((resolve, reject) => {
				SettingModel.data()
					.then(setting => {
						app.setting = setting
						resolve(setting)
					}).catch(reject)
			})
		},

		// 获取当前用户信息
		getUserInfo() {
			const app = this
			return new Promise((resolve, reject) => {
				!app.isLogin ? resolve(null) : UserApi.info({}, {
					load: app.isFirstload
				})
					.then(result => {
						app.userInfo = result.data.userInfo
						resolve(app.userInfo)
					})
					.catch(err => {
						if (err.result && err.result.status == 401) {
							app.isLogin = false
							resolve(null)
						} else {
							reject(err)
						}
					})
			})
		},

		// 获取账户资产
		getUserAssets() {
			const app = this
			return new Promise((resolve, reject) => {
				!app.isLogin ? resolve(null) : UserApi.assets({}, {
					load: app.isFirstload
				})
					.then(result => {
						app.assets = result.data.assets
						resolve(app.assets)
					})
					.catch(err => {
						if (err.result && err.result.status == 401) {
							app.isLogin = false
							resolve(null)
						} else {
							reject(err)
						}
					})
			})
		},

		// 获取当前用户待处理的订单数量
		getTodoCounts() {
			const app = this
			return new Promise((resolve, reject) => {
				!app.isLogin ? resolve(null) : OrderApi.todoCounts({}, {
					load: app.isFirstload
				})
					.then(result => {
						app.todoCounts = result.data.counts
						resolve(app.todoCounts)
					})
					.catch(err => {
						if (err.result && err.result.status == 401) {
							app.isLogin = false
							resolve(null)
						} else {
							reject(err)
						}
					})
			})
		},

		// 跳转到登录页
		handleLogin() {
			!this.isLogin && this.$navTo('pages/login/index')
		},

		// 跳转到修改个人信息页
		handlePersonal() {
			this.$navTo('pages/user/personal/index')
		},

		// 退出登录
		handleLogout() {
			const app = this
			uni.showModal({
				title: '友情提示',
				content: '您确定要退出登录吗?',
				success(res) {
					if (res.confirm) {
						store.dispatch('Logout', {})
							.then(result => app.onRefreshPage())
					}
				}
			})
		},

		// 跳转到钱包页面
		onTargetWallet() {
			this.$navTo('pages/wallet/withdrawCash/index')
		},

		// 跳转到乐享豆页面
		onLXBean() {
			this.$navTo('pages/wallet/lxBean/index')
		},

		// 跳转到我的团队页面
		onMyTeam() {
			this.$navTo('pages/user/myTeam/index')
		},

		// 跳转到订单页
		onTargetOrder(item) {
			this.$navTo('pages/order/index', {
				dataType: item.id
			})
		},

		// 跳转到我的积分页面
		onTargetPoints() {
			this.$navTo('pages/points/log')
		},

		// 跳转到我的优惠券页
		onTargetMyCoupon() {
			this.$navTo('pages/contribution/index')
		},

		onTargetSign() {
			this.$navTo('pages/user/signLog')
		},

		// 跳转到服务页面
		handleService({
			url
		}) {
			if (url !== 'dialog') {
				this.$navTo(url)
			} else {
				this.isPassWord = true
			}
		},

	},

	/**
	 * 下拉刷新
	 */
	onPullDownRefresh() {
		// 获取首页数据
		this.getPageData(() => {
			uni.stopPullDownRefresh()
		})
	},


}
</script>

<style lang="scss" scoped>
// 页面头部
.main-header {
	background-color: #fff;
	position: relative;
	width: 100%;
	height: 280rpx;
	background-size: 100% 100%;
	overflow: hidden;
	display: flex;
	align-items: center;
	padding-left: 30rpx;

	.bg-image {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 0;
	}

	.my-money {
		position: absolute;
		bottom: 0;
		left: 0;
		margin-left: 130rpx;
	}

	.user-info {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 100rpx;
		z-index: 1;

		.user-info-box {
			display: flex;
			height: 150rpx;
			z-index: 1;
		}

		.user-content {
			display: flex;
			flex-direction: column;
			justify-content: center;
			margin-left: 30rpx;
			color: #c59a46;

			.nick-name {
				font-size: 34rpx;
				font-weight: bold;
				max-width: 270rpx;
			}

			.mobile {
				// margin-top: 15rpx;
				font-size: 28rpx;
			}


			.login-tips {
				margin-top: 12rpx;
				font-size: 30rpx;
			}

		}


		.user-grade {
			display: flex;
			margin-top: 12rpx;
			margin: 12rpx 0 0 12rpx;
			border-radius: 10rpx;
		}

		.user-invite {
			border-radius: 20px;
			background-color: #fff;
			border: 1px solid #bbbbbb;
			padding: 2px 10px;
			align-self: flex-end;
			margin-right: 15px;
		}
	}

	.user-info-unlogin {
		width: 100%;
		display: flex;
		height: 100rpx;
		z-index: 1;

		.user-content {
			display: flex;
			flex-direction: column;
			justify-content: center;
			margin-left: 30rpx;
			color: #c59a46;

			.nick-name {
				font-size: 34rpx;
				font-weight: bold;
				max-width: 270rpx;
			}

			.login-tips {
				margin-top: 12rpx;
				font-size: 30rpx;
			}

		}
	}
}

// 角标组件
.item-badge {
	position: absolute;
	top: 0;
	right: 55rpx;
	background: #fa2209;
	color: #fff;
	border-radius: 100%;
	min-width: 38rpx;
	height: 38rpx;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1rpx;
	font-size: 24rpx;
}

// 我的钱包
.my-asset {
	display: flex;
	background: #fff;
	padding: 40rpx 0;

	.asset-right {
		width: 200rpx;
		// border-left: 1rpx solid #eee;
	}

	.asset-right-item {
		text-align: center;
		color: #545454;

		.item-icon {
			font-size: 44rpx;
		}

		.item-name {
			margin-top: 14rpx;
			font-size: 28rpx;
		}

	}

	.asset-left-item {
		max-width: 183rpx;
		text-align: center;
		color: #666;
		padding: 0 16rpx;

		.item-value {
			font-size: 34rpx;
			color: red;
		}

		.item-name {
			margin-top: 6rpx;
		}

		.item-name {
			margin-top: 14rpx;
			font-size: 28rpx;
		}
	}

}

.signin-box {
	position: relative;
	background-color: #fff;
	margin: 22rpx;
	padding: 20rpx 0;

	.signin-title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 28rpx;
		font-weight: 700;
		margin-bottom: 30rpx;
		margin-left: 30rpx;
	}

	.signin-content {
		position: relative;
		width: 100%;
		display: flex;
		justify-content: space-between;
		z-index: 1;

		.signin-child {
			width: 100%;
			text-align: center;

			.child-transform {
				@-webkit-keyframes roundRule {

					0%,
					100% {

						-webkit-transform: rotate(-15deg);

					}

					50% {

						-webkit-transform: rotate(15deg);

					}

				}

				-webkit-animation: roundRule 0.3s ease-in-out infinite;

				-webkit-transform-origin: center center;
			}

			.success-box {
				position: relative;

				.success-img {}

				.success-title {
					position: absolute;
					top: 5%;
					left: 50%;
					transform: translateX(-50%);
					font-size: 10rpx;
					color: #D1121A;
					opacity: 0.8;
				}

				.success-tip {
					position: absolute;
					bottom: 10%;
					left: 50%;
					transform: translateX(-50%);
					font-size: 10rpx;
					color: #fff;
					opacity: 0.8;
				}
			}
		}
	}

	.box-line {
		display: block;
		position: absolute;
		top: 55%;
		left: 50%;
		width: 80%;
		height: 1px;
		transform: translateX(-50%);
		background-color: #FFEADB;
	}
}

// 订单操作
.order-navbar {
	display: flex;
	margin: 20rpx auto 20rpx auto;
	padding: 20rpx 0;
	width: 94%;
	box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
	font-size: 30rpx;
	border-radius: 5rpx;
	background: #fff;

	&-item {
		position: relative;
		width: 25%;

		.item-icon {
			text-align: center;
			margin: 0 auto;
			padding: 10rpx 0;
			color: #545454;
			font-size: 44rpx;
		}

		.item-name {
			font-size: 28rpx;
			color: #545454;
			text-align: center;
			margin-right: 10rpx;
		}

	}
}

// 我的服务
.my-service {
	margin: 22rpx auto 22rpx auto;
	padding: 22rpx 0;
	width: 94%;
	box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
	border-radius: 5rpx;
	background: #fff;

	.service-title {
		padding-left: 24rpx;
		margin-bottom: 20rpx;
		font-size: 30rpx;
	}

	.service-content {

		margin-bottom: -20rpx;

		.service-item {
			position: relative;
			width: 25%;
			float: left;
			margin-bottom: 30rpx;

			.item-icon {
				text-align: center;
				margin: 0 auto;
				padding: 14rpx 0;
				color: #ff3800;
				font-size: 44rpx;
			}

			.item-name {
				font-size: 28rpx;
				color: #545454;
				text-align: center;
				margin-right: 10rpx;
			}

		}
	}
}

// 退出登录
.my-logout {
	display: flex;
	justify-content: center;
	align-items: center;
	margin-top: 50rpx;

	.logout-btn {
		width: 60%;
		margin-right: 40rpx;
		font-size: 28rpx;
		color: #616161;
		border-radius: 20rpx;
		border: 1px solid #dcdcdc;
		padding: 16rpx 0;
		text-align: center;
	}
}

.rule-box {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0 12px;
	background-color: #fff;
	border-radius: 12px;
	padding: 0 12px;

	.rule-title {
		font-size: 15px;
		padding: 12px 0;
		font-weight: 600;
	}

	.rule-table {
		width: 100%;
		text-align: center;
		padding: 0;
		margin: 0;
		box-sizing: border-box;

		table {
			width: 100%;
			border-collapse: collapse;
		}

		th {
			border: 1px solid #e6e6e6;
		}

		td {
			border: 1px solid #e6e6e6;
		}
	}

	.rule-attention {
		font-size: 8px;
		font-weight: 600;
		margin: 12px 0;
	}

	.close-icon {
		position: absolute;
		right: 12px;
		top: 8px;

		img {
			width: 15px;
		}
	}
}

.invite-box {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	background-color: #fff;
	border-radius: 12px;

	.invite-title {
		font-size: 15px;
		padding: 12px 0;
		font-weight: 600;
		margin: 0 20px;
	}

	.invite-table {
		font-size: 12px;
		margin: 20px 0 40px 0;
	}

	.invite-attention {
		border-top: 1px solid #fafafa;
		font-size: 14px;
		padding: 10px 100px;
	}
}

.red-envelope-box {
	width: 1px;
	height: 1px;
	position: relative;

	.img-box {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-45%, -50%);

		.box-img {
			width: 100vw;
		}

		.box-title {
			position: absolute;
			display: flex;
			flex-direction: column;
			justify-content: center;
			top: 58%;
			left: 50%;
			transform: translateX(-60%);
			text-align: center;

			.title-top {
				font-size: 50rpx;
				font-weight: 700;
				color: #fff;
			}

			.title-bottom {}
		}
	}
}

.password_box {
	width: 600rpx;

	.password_title {
		padding-top: 20rpx;
		text-align: center;
		font-weight: 600;
		font-size: 32rpx;
		margin: 20rpx auto;
	}

	.form {
		width: 80%;
		margin: 50rpx auto 20rpx;
	}

	.button {
		width: 500rpx;
		height: 70rpx;
		background-color: rgb(255, 44, 59);
		border-radius: 25rpx;
		margin: 30rpx auto;
		text-align: center;
		color: white;
		line-height: 70rpx;
	}
}
</style>